package wk10p3;

class IntArray {
	private int[] x;
	public IntArray() {}
	public IntArray(int[] x_in) {
		if (x_in != null){
			x = new int[ x_in.length ];
			for (int i=0; i<x_in.length; i++) x[i] = x_in[i];
		}
	}
	public int[] getX() {	return x;	}
	public String toString() {
		String result = "[ ";
		for (int i : x)
			result = result + i + ", ";
		return  result + " ]";	
	}
}

class DoubleArray {
	private double[] x;
	public DoubleArray() {}
	public DoubleArray(double[] x_in) {
		if (x_in != null){
			x = new double[ x_in.length ];
			for (int i=0; i<x_in.length; i++) x[i] = x_in[i];
		}
	}
	public double[] getX() {	return x;	}
	public String toString() {
		String result = "[ ";
		for (double i : x)
			result = result + i + ", ";
		return  result + " ]";	
	}
}

class StringArray {
	private String[] x;
	public StringArray() {}
	public StringArray(String[] x_in) {
		if (x_in != null){
			x = new String[ x_in.length ];
			for (int i=0; i<x_in.length; i++) x[i] = x_in[i];
		}
	}
	public String[] getX() {	return x;	}
	public String toString() {
		String result = "[ ";
		for (String i : x)
			result = result + i + ", ";
		return  result + " ]";	
	}
}

public class ClassArraysOfThings {
	public static void main(String[] args) {
		int[] ix =  {7, 23, 102, -65};
		double[] dx = {7.45, 0.23e-4, -34.25};
		String[] sx = {"Hello", "CSIS 235", "This is a", "good day"};
		IntArray i = new IntArray( ix );
		System.out.println(" i: " + i);
		DoubleArray d = new DoubleArray( dx );
		System.out.println(" d: " + d);
		StringArray s = new StringArray( sx );
		System.out.println(" s: " + s);
		
	}
}
